from BeautifulReport import BeautifulReport
import yagmail
import time
import logging
def time_l():
    sleep_time=time.strftime("%Y%m%d-%H%M%S")
    return sleep_time
class Tools():

    def log(self):
        l=logging.basicConfig(level=logging.DEBUG,format="%(asctime)s %(levelname)s %(message)s",filename=f"{time_l()}.log",filemode="a+")
        return l
    def baogao(self,suite):
        b=BeautifulReport(suite).report(description="这是报告",filename=f"{time_l()}.html",log_path="./")
        return b
    def mail(self,file):
        yaml=yagmail.SMTP(user="3421804764@qq.com",password="ubnavehqwgiddcbe",host="smtp.qq.com")
        yaml.send(to="3421804764@qq.com",subject="这是发送的日志和报告",contents="报告",attachments=file)
        yaml.close()
